<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<script type="text/javascript">
	if(${sessionScope.user==null}){
		window.location.href="login.jsp";
	}
</script>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String ws="ws://"+request.getServerName()+":" + request.getServerPort()+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
	<title>首页</title>
	<meta charset="utf-8">
	
	<!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

	<link href="less/Black.ico" rel="shortcut icon" />
	<link href="resourse/css/bootstrap.min14ed.css?v=3.3.6" 		rel="stylesheet">
	<link href="resourse/css/font-awesome.min93e3.css?v=4.4.0" 		rel="stylesheet">
	<%--<link href="resourse/css/font1-awesome.min.css"rel="stylesheet">--%>
	<link href="resourse/css/animate.min.css" 						rel="stylesheet">
	<link href="resourse/css/style.min862f.css" 			rel="stylesheet">
	<link href="resourse/plugins/tmsg/css/iziToast.min.css" 			rel="stylesheet">
</head>

<body class="fixed-sidebar full-height-layout gray-bg" style="overflow: hidden;font-family:微软雅黑;">
<input type="hidden" name="path"     id="path"   value="<%=request.getContextPath()%>" />
<input type="hidden"      id="init"    />
<input type="hidden"   id="sessionid" value="">
<input type="hidden"   id="ws" value="<%=ws%>">
<input type="hidden"   id="basePath" value="<%=basePath%>">
<ul class="nav nav-pills pull-left" style="background-color:#222d33; width:1400px;height:50px;">
 <li role="presentation"></li>
 <li style="margin:8px 0 0 28px"> <font style="color:#fff;font-size:23px">校友问卷系统</font></li>
</ul>
	<div id="wrapper"style="margin-top:50px">
		<!--左侧导航开始-->
		<nav class="navbar-default navbar-static-side" role="navigation" >
			<div class="nav-close">
				<i class="fa fa-times-circle"></i>
			</div>
			<div class="sidebar-collapse">
				<ul class="nav" id="side-menu1">

				</ul>
			</div>
		</nav>
		<!--左侧导航结束-->

		<!--右侧部分开始-->
		<div id="page-wrapper" class="gray-bg dashbard-1">
			<div class="row border-bottom">
				<img alt='image' id="user_url" class='img-circle  my_image' style="position:absolute;right:220px;top:10px;height:35px;" src='image/default.jpg'>
             <b id="admin" style="font-family:微软雅黑; color:#fff; font-size:12px; position:absolute;right:280px;top:18px">
				欢迎您：</b>
				<div class="row border-bottom ">
					<div style="position:absolute;right:180px;top:15px;background-color:#222d33; cursor:pointer">
						<!--邮箱-->

						<a   class="dropdown-toggle count-info" data-toggle="dropdown" href="#">
							<i  class="fa fa-envelope"></i>
							<span class="label label-warning" id="email_num"></span>
						</a>
						<ul class="dropdown-menu dropdown-menu-right animated fadeInDown" id="email_ul"  style="width: 300px;">


							<li   id="email_lil">
								<div class="text-center link-block">
									<a  id="email_li" class="J_menuItem" href=<%=request.getContextPath()+"/Email/emailPage"%>>
										<i class="fa fa-envelope"></i> <strong> 查看邮件</strong>
									</a>
								</div>
							</li>
						</ul>

					</div>
					<!--用户信息-->
             <div style="position:absolute;right:60px;top:18px;background-color:#222d33; cursor:pointer">
                    <span class="dropdown J_tabClose"  id="dropdown1" data-toggle="dropdown" style="height: 35px;color:#fff;font-family:微软雅黑;font-size:12px"><b>  <i class="fa  fa-desktop" style="color:#fff; font-size:12px"></i>&nbsp;用户登录信息</b><span class="caret"></span>
                    </span>
                    <ul role="menu" class="dropdown-menu dropdown-menu-right animated fadeInDown"style="margin-top:15px">
						<li class="J_tabShowActive"><a  style="margin-right:32px"><i class="fa fa-credit-card" style="color:#F6BB42;font-size:15px"></i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;账号：<span id="user_username"></span></a>
						</li>
						<li class="divider"></li>
						<li class="J_tabShowActive"><a  style="margin-right:32px"><i class="fa fa-phone" style="color:#F6BB42;font-size:15px"></i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;手机：<span id="user_phone"></span></a>
						</li>
						<li class="divider"></li>
						<li class="J_tabShowActive"><a  style="margin-right:32px"><i class="fa fa-envelope" style="color:#F6BB42;font-size:15px"></i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;邮箱：<span id="user_email"></span></a>
						</li>
						<li class="divider"></li>
                         <li class="J_tabShowActive"><a  style="margin-right:32px"><i class="fa fa-clock-o" style="color:#F6BB42;font-size:15px"></i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;登录时间：<span id="logintime"></span></a>
                        </li>
                         <li class="divider"></li>
                        <li class="J_tabCloseOther"><a style="margin-right:166px" href="loginPage"><i class="fa fa-user-times" style="color:#E9573F;font-size:17px"></i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注销</a>
                        </li>
                    </ul>
			 </div>


            </div>

			</div>
			<div class="row content-tabs" style="height: 40px;border-bottom:1px solid #dee5e7;margin:0.4% -0.8% 0 -0.5%">
				 <button class="navbar-minimalize minimalize-styl-2   roll-nav roll-left J_tabLeft"  style="margin-top:0.2px;margin-left:5px;height: 38px;width:50px;font-size:15px;padding-top: 0px;padding-left: 8px"  href="#">
				    <i class=" fa fa-bars" style="color:#37BC9B">  </i>
				 </button>
				 <button class="roll-nav roll-left J_tabLeft" id="roll-nav3"  style="margin-top:1px;margin-left:60px;height:38px"><i class="fa fa-backward" style="color:#37BC9B"></i>
                 </button>   
				<nav class="page-tabs J_menuTabs" style="margin-top:2px;margin-left:108px">
					<div class="page-tabs-content">
						<a href="javascript:;" class="active J_menuTab"
							data-id="page1.html" style="height:37px">首页</a>

					</div>
				</nav>
				<button class="roll-nav roll-right J_tabRight" style="height:39px">
					<i class="fa fa-forward"></i>
				</button>
				<div class="btn-group roll-nav roll-right">
					<button class="dropdown J_tabClose" data-toggle="dropdown" style="height:39px">
						关闭操作
						<span class="caret" style="margin-left: 0px;"></span>
					</button>
					<ul role="menu" class="dropdown-menu dropdown-menu-right">
						<li class="J_tabShowActive"><a>定位当前选项卡</a></li>
						<li class="divider"></li>
						<li class="J_tabCloseAll"><a>关闭全部选项卡</a></li>
						<li class="J_tabCloseOther"><a>关闭其他选项卡</a></li>
					</ul>
				</div>
				<a href="logout.do" class="roll-nav roll-right J_tabExit" style="height:39px">
					<i class="fa fa fa-sign-out"></i> 退出
				</a>
			</div>
			<!-- 首页 -->
			<div class="row J_mainContent" id="content-main">

				<iframe class="J_iframe" name="iframe0" width="100%"
								 height="100%" src="test2.jsp" frameborder="0"
								 data-id="page1.html" seamless>
			</iframe>
			</div>


			<!-- 页脚版权 -->
			<div class="footer">
				<div class="">
					&copy; 2016-2017

				</div>
			</div>
		</div>
		<!--右侧部分结束-->
	</div>
	<script src="resourse/js/jquery.min.js?v=2.1.4"></script>
	<script src="resourse/js/bootstrap.min.js?v=3.3.6"></script>
	<script src="resourse/js/plugins/metisMenu/jquery.metisMenu.js"></script>
	<script src="resourse/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
	<script src="resourse/js/plugins/layer/layer.min.js"></script>
	<script src="resourse/js/plugins/pace/pace.min.js"></script>
	<script src="resourse/plugins/tmsg/js/iziToast.min.js"></script>

		
	<script type="text/javascript">
		if(${sessionScope.user==null}){
			window.location.href="login.jsp";
		}
		else{
			$("#admin").text($("#admin").text()+'${sessionScope.user.realname}'+'(${sessionScope.user.userTypeTo})');
			$("#init").data("userid",'${sessionScope.user.id}');
			var url='${sessionScope.user.url}';
			if(url!=null&&url!="")
			$("#user_url").attr("src",'${sessionScope.user.url}');
			$("#user_username").text('${sessionScope.user.username}');
			$("#user_phone").text('${sessionScope.user.phone}');
			$("#user_email").text('${sessionScope.user.email}');
			var myDate = new Date();
			$("#logintime").text(myDate.toLocaleString());


		}
			//返回json数据为data/menu2.json文件形式时 
			$(function(){
				$.getJSON("tree",function(trees){
				var showlist = $("<ul class='nav' id='side-menu'></ul>");
				//console.log("trees:"+trees);
                showall(trees, showlist);
                    $("div.sidebar-collapse").html("");
                $("div.sidebar-collapse").append(showlist);
               
                
                include_js("resourse/js/hplus.min.js?v=4.1.0");
                include_js("resourse/js/contabs.min.js");
				include_js("jsp/sys/main.js");
                
				});

    $("#email_li").click(function(){
        $("#email_lil").trigger("click");
    });
			});
		//左侧树的遍历（可以在这修改小图标）	
		function showall(trees, parent) {
			for(var i=0;i<trees.length;i++){
				//如果该节点是二级菜单节点 
				if(trees[i].pId != 0 && trees[i].trees.length == 0){
					$("<li></li>").append("<a class='J_menuItem' href='"+trees[i].url+"'><i class='fa fa-angle-double-right'style='color:#66cab2;font-size:15px;margin:0 10px 0 0px'></i>"+trees[i].treename+"</a>").appendTo(parent); 
				}
				else if(trees[i].trees.length > 0){
					var li = $("<li></li>");
                    //将li的文本设置好，并马上添加一个空白的ul子节点，并且将这个li添加到父亲节点中
                    if(trees[i].treename == '日志模块'){
                    	$(li).append("<a href='#'><i class='fa fa-pencil-square-o' style='margin-right:30px;color:#F6BB42;font-size:15px'></i> <span class='nav-label'>"+trees[i].treename+"</span><span class='fa arrow'></span></a>").append("<ul class='nav nav-second-level'></ul>").appendTo(parent);
                    }else if(trees[i].treename == '系统模块'){
                    	$(li).append("<a href='#'><i class='fa fa-qrcode' style='margin-right:30px;color:#8CC152;font-size:15px'></i> <span class='nav-label'>"+trees[i].treename+"</span><span class='fa arrow'></span></a>").append("<ul class='nav nav-second-level'></ul>").appendTo(parent);
                    }else if(trees[i].treename == '配置模块'){
                    	$(li).append("<a href='#'><i class='fa fa-wrench' style='margin-right:30px;color:#3BAFDA;font-size:15px'></i> <span class='nav-label'>"+trees[i].treename+"</span><span class='fa arrow'></span></a>").append("<ul class='nav nav-second-level'></ul>").appendTo(parent);
                    }else if(trees[i].treename == '配置查看模块'){
                    	$(li).append("<a href='#'><i class='fa fa-gears' style='margin-right:30px;color:#E9573F;font-size:15px'></i> <span class='nav-label'>"+trees[i].treename+"</span><span class='fa arrow'></span></a>").append("<ul class='nav nav-second-level'></ul>").appendTo(parent);
                    }else if(trees[i].treename == '运行监控'){
                    	$(li).append("<a href='#'><i class='fa fa-eye' style='margin-right:30px;color:#37bc9b;font-size:15px'></i> <span class='nav-label'>"+trees[i].treename+"</span><span class='fa arrow'></span></a>").append("<ul class='nav nav-second-level'></ul>").appendTo(parent);
                    }else if(trees[i].treename == '经营分析'){
                    	$(li).append("<a href='#'><i class='fa fa-bar-chart' style='margin-right:30px;color:#0085ae;font-size:15px'></i> <span class='nav-label'>"+trees[i].treename+"</span><span class='fa arrow'></span></a>").append("<ul class='nav nav-second-level'></ul>").appendTo(parent);
                    }else{
                    	$(li).append("<a href='#'><i class='fa fa-home' style='margin-right:30px;color:#0085ae;font-size:15px'></i> <span class='nav-label' >"+trees[i].treename+"</span><span class='fa arrow'></span></a>").append("<ul class='nav nav-second-level'></ul>").appendTo(parent);
                    }
                    
                   // $(li).append("<a href='#'><i class='fa fa-home'></i> <span class='nav-label'>"+trees[i].treename+"</span><span class='fa arrow'></span></a>").append("<ul class='nav nav-second-level'></ul>").appendTo(parent);
                    
                    //将空白的ul作为下一个递归遍历的父亲节点传入
                    showall(trees[i].trees, $(li).children().eq(1)); 
				}
				//如果该节点没有子节点，则直接将该节点li以及文本创建好直接添加到父亲节点中
				else{
					$("<li></li>").append("<a  class='J_menuItem' href='"+trees[i].url+"' ><i class='fa fa-tv'></i><span class='nav-label'>"+trees[i].treename+"</span></a>").appendTo(parent);
				}
			}
		}
         
         //加载js文件的函数
		function include_js(path) {
			var sobj = document.createElement('script');
			sobj.type = "text/javascript";
			sobj.src = path;
			var headobj = document.getElementsByTagName('head')[0];
			headobj.appendChild(sobj);
			}
	</script>
</body>
</html>